package com.zhenfan.pattern.simplefactory;

import com.zhenfan.pattern.entity.BuLuTuo;
import com.zhenfan.pattern.entity.ChaiQuan;
import com.zhenfan.pattern.entity.Dog;
import com.zhenfan.pattern.entity.HaShiQi;

/**
 * 简单工厂
 *
 * @author wangmh
 * @create 2018-10-19 16:31
 **/
public class SimpleFactory {

    public Dog getDog(String type) {
        switch (type) {
            case "BuLuTuo":
                return new BuLuTuo();
            case "ChaiQuan":
                return new ChaiQuan();
            case "HaShiQi":
                return new HaShiQi();
            default:
                System.out.println("找不到对应的狗");
                return null;
        }
    }
}
